home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / OS / FWGraphx / FWGC.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  4.1 KB  |  153 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWGC.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWGC_H
  11. #define FWGC_H
  12.  
  13. #ifndef SLGRDEF_H
  14. #include "SLGrDef.h"
  15. #endif
  16.  
  17. #ifndef SLGC_H
  18. #include "SLGC.h"
  19. #endif
  20.  
  21. #ifndef SLGDEV_H
  22. #include "SLGDev.h"
  23. #endif
  24.  
  25. #ifndef FWPOINT_H
  26. #include "FWPoint.h"
  27. #endif
  28.  
  29. #ifndef FWRECT_H
  30. #include "FWRect.h"
  31. #endif
  32.  
  33. #ifndef FWMAPING_H
  34. #include "FWMaping.h"
  35. #endif
  36.  
  37. // ----- Foundation Includes -----
  38.  
  39. #ifndef FWEXCLIB_H
  40. #include "FWExcLib.h"
  41. #endif
  42.  
  43. // ----- Platform Includes -----
  44.  
  45. #if defined(FW_BUILD_WIN) && !defined(_INC_WINDOWS)
  46. #include <windows.h>
  47. #endif
  48.  
  49. //========================================================================================
  50. //    Forward Declarations
  51. //========================================================================================
  52.  
  53. class    ODShape;
  54. class    ODCanvas;
  55. class    ODTransform;
  56.  
  57. struct    FW_SPrivSuspendResumeState;
  58.  
  59. //========================================================================================
  60. //    class FW_CGraphicContext
  61. //========================================================================================
  62.  
  63. class    FW_CGraphicContext : public FW_SGraphicContext
  64. {
  65. //----------------------------------------------------------------------------------------
  66. //    Constructors/Destructors
  67. //
  68. public:
  69.     FW_DECLARE_AUTO(FW_CGraphicContext)
  70.  
  71.     virtual ~FW_CGraphicContext();
  72.  
  73. protected:
  74.     FW_CGraphicContext(Environment* ev);
  75.     
  76.     // ----- Init Graphic Context with a transform
  77.     void    InitGraphicContext(FW_HGDevice graphicDevice,
  78.                                ODTransform* transform,
  79.                                ODShape* clipShape);
  80.                                 
  81.     // ----- Terminate the Graphic Context
  82.     void    TerminateGraphicContext();
  83.  
  84. //----------------------------------------------------------------------------------------
  85. //    New API
  86. //
  87. public:
  88.     // ----- Conversion -----
  89.     FW_CPlatformPoint        LogicalToDevice(FW_Fixed xSize, FW_Fixed ySize) const;
  90.     FW_CPlatformPoint        LogicalToDevice(const FW_CPoint& point) const;
  91.     FW_CPlatformRect        LogicalToDevice(const FW_CRect& rect) const;
  92.     ODShape*                LogicalToDevice(ODShape* shape) const;
  93.                                 
  94.     FW_CPoint                DeviceToLogical(FW_PlatformCoordinate xSize, FW_PlatformCoordinate ySize) const;
  95.     FW_CPoint                DeviceToLogical(const FW_CPlatformPoint& point) const;
  96.     FW_CRect                DeviceToLogical(const FW_CPlatformRect& rect) const;
  97.     ODShape*                DeviceToLogical(ODShape* region) const;
  98.  
  99.     // ----- Clipping -----
  100.     ODShape*                AcquireClip() const;                        // the resulting shape belongs to the caller
  101.     void                    SetClip(ODShape* odShape);                    // a copy of odShape is used
  102.     
  103.     void                    GetClipRect(FW_SRect& clipRect) const;
  104.     void                    SetClipRect(const FW_SRect& clipRect);
  105.  
  106.     // ----- Mapping -----
  107.     void                    SetMapping(const FW_SMapping& newMapping);
  108.     void                    GetMapping(FW_CMapping& mapping) const;
  109.  
  110.     virtual void            Reset() = 0;
  111.     
  112. protected:
  113.     void                    PrivReset(ODTransform* transform,
  114.                                     ODShape* clipShape);
  115.  
  116. //----------------------------------------------------------------------------------------
  117. //    Getters for members defined in FW_SGraphicContext
  118. //
  119. public:
  120.     FW_HGDevice                GetGraphicDevice() const    
  121.                                 { return fGraphicDevice; }
  122.         
  123.     ODPlatformCanvas        GetPlatformCanvas() const
  124.                                 {     return FW_PrivGDev_GetPlatformCanvas(fGraphicDevice); }
  125.     
  126.     Environment*            GetEnvironment() const
  127.                                 { return fEnvironment; }
  128.  
  129. private:
  130.     FW_CGraphicContext(const FW_CGraphicContext& other);
  131.     FW_CGraphicContext& operator=(const FW_CGraphicContext& other);
  132.         // Copy constructor and assignment operator not valid for this class.    
  133. };
  134.  
  135. //========================================================================================
  136. //    class FW_CSaveRestoreContext
  137. //========================================================================================
  138.  
  139. class    FW_CSaveRestoreContext
  140. {
  141. public:
  142.     FW_DECLARE_AUTO(FW_CSaveRestoreContext)
  143.  
  144.     FW_CSaveRestoreContext(FW_CGraphicContext& gc);
  145.     virtual ~ FW_CSaveRestoreContext();
  146.  
  147. private:
  148.     FW_CGraphicContext&        fGC;
  149.     FW_SPrivSuspendResumeState*    fSuspendResume;
  150. };
  151.  
  152. #endif
  153.